
#!/usr/bin/python
# -*- coding: UTF-8 -*-

from Scripts.Startup import StartupConfigColumnData
from Scripts.Common import Map

#
# config data structure
# @author Lee
#
class Class:
    #the config data classify
    _dataClassify = ""
    #the absolution url of a excel
    _excelUrl = ""
    #the sheet of a excel
    _excelSheet = ""
    #the output name
    _outputName = ""
    #the column datas
    _columns = None


    #
    # the constructed process
    # @param [dataClassify] the config data classify
    # @param [excelUrl] the absolution url of a excel
    # @param [excelSheet] the sheet of a excel
    # @param [outputName] the output name
    #
    def __init__(self, dataClassify, excelUrl, excelSheet, outputName):
        self._dataClassify = dataClassify
        self._excelUrl = excelUrl
        self._excelSheet = excelSheet
        self._outputName = outputName
        self._columns = Map.Class()

    #
    # Gets the config data classify
    # @return the config data classify
    #
    def GetClassify(self):
        return self._dataClassify

    #
    # Gets the absolution url of a excel
    # @return the absolution url of a excel
    # 
    def GetExcelUrl(self):
        return self._excelUrl

    #
    # Gets the sheet of a excel
    # @return the sheet of a excel
    #
    def GetExcelSheet(self):
        return self._excelSheet
    
    #
    # Gets the output name
    # @return the output name
    #
    def GetOutputName(self):
        return self._outputName

    #
    # Adds the column data
    # @param [dataName] column name
    # @param [outputName] output name
    # @param [dataType] data format
    #
    def AddColumnData(self, dataName, outputName, dataType):
        if None == self._columns:
            return
        
        isExist = self._columns.ExistData(dataName)
        if True == isExist:
            return
        
        columnData = StartupConfigColumnData.Class(dataName, outputName, dataType)
        self._columns.SetData(dataName, columnData)

    #
    # Gets the column count
    # @return the column count
    #
    def GetColumnCount(self):
        if None == self._columns:
            return 0
        
        columnCount = self._columns.GetCount()
        return columnCount

    #
    # Gets the column data
    # @param [index] the column data with sprecified index
    # @return the column data
    #
    def GetColumnData(self, index):
        if None == self._columns:
            return None

        columnData = self._columns.GetData(index)
        return columnData

